check check writability of the file

38

os.access('sample.txt', os.W_OK)
#Output False
f = open("sample.txt", "x") # create the file
#check again
os.access('sample.txt', os.W_OK)
#Output True

Comments

Submit
0 Comments